package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.sql.Time;
import java.util.Date;
import java.util.Objects;

@Entity
public class Competitor {
    private long compeId;
    private String compeCompany;
    private String compeProduct;
    private Long compeMoney;
    private String compeAdvantage;
    private String compeInferior;
    private String compeTatics;
    private Date compeDate;
    private String compeState;
    private Sales sales;

    @ManyToOne
    @JoinColumn(name = "sales_id2")
    public Sales getSales() {
        return sales;
    }

    public void setSales(Sales sales) {
        this.sales = sales;
    }

    @Basic
    @Column(name = "compe_state")
    public String getCompeState() {
        return compeState;
    }

    public void setCompeState(String compeState) {
        this.compeState = compeState;
    }

    @Id
    @Column(name = "compe_id")
    @GeneratedValue(generator  =  "seq",strategy  =  GenerationType.SEQUENCE)
    //定义一个序列生成器
    @SequenceGenerator(name  =  "seq",sequenceName  =  "crm",
            initialValue  =  1,allocationSize  =  1)
    public long getCompeId() {
        return compeId;
    }

    public void setCompeId(long compeId) {
        this.compeId = compeId;
    }

    @Basic
    @Column(name = "compe_company")
    public String getCompeCompany() {
        return compeCompany;
    }

    public void setCompeCompany(String compeCompany) {
        this.compeCompany = compeCompany;
    }

    @Basic
    @Column(name = "compe_product")
    public String getCompeProduct() {
        return compeProduct;
    }

    public void setCompeProduct(String compeProduct) {
        this.compeProduct = compeProduct;
    }

    @Basic
    @Column(name = "compe_money")
    public Long getCompeMoney() {
        return compeMoney;
    }

    public void setCompeMoney(Long compeMoney) {
        this.compeMoney = compeMoney;
    }

    @Basic
    @Column(name = "compe_advantage")
    public String getCompeAdvantage() {
        return compeAdvantage;
    }

    public void setCompeAdvantage(String compeAdvantage) {
        this.compeAdvantage = compeAdvantage;
    }

    @Basic
    @Column(name = "compe_inferior")
    public String getCompeInferior() {
        return compeInferior;
    }

    public void setCompeInferior(String compeInferior) {
        this.compeInferior = compeInferior;
    }

    @Basic
    @Column(name = "compe_tatics")
    public String getCompeTatics() {
        return compeTatics;
    }

    public void setCompeTatics(String compeTatics) {
        this.compeTatics = compeTatics;
    }

    @Basic
    @Column(name = "compe_date")
    public Date getCompeDate() {
        return compeDate;
    }

    public void setCompeDate(Date compeDate) {
        this.compeDate = compeDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Competitor that = (Competitor) o;
        return compeId == that.compeId &&
                Objects.equals(compeCompany, that.compeCompany) &&
                Objects.equals(compeProduct, that.compeProduct) &&
                Objects.equals(compeMoney, that.compeMoney) &&
                Objects.equals(compeAdvantage, that.compeAdvantage) &&
                Objects.equals(compeInferior, that.compeInferior) &&
                Objects.equals(compeTatics, that.compeTatics) &&
                Objects.equals(compeDate, that.compeDate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(compeId, compeCompany, compeProduct, compeMoney, compeAdvantage, compeInferior, compeTatics, compeDate);
    }
}
